/*
 * AICファイルの読み込み
 */
void
AicLoad(unsigned short bank, unsigned char *filename)
	{
	int	fp, i, num;
	int	x,y;

	pio_putstr( "Sprite data loading..." );

	// ファイルを開く
	fp = pio_fopen(filename, "rb" );
	if ( fp == -1 )
		{
		pio_putstr( "\nCannot open AIC file.\n" );
		return;
		}
	i = pio_fread( fp, 4, (char *)( &num ) );
	if ( i < 4 )
		{
		pio_putstr( "\nAIC file read error.\n" );
		return;
		}
	i = pio_fread( fp, num, (char *)buf );
	if ( i < num )
		{
		pio_putstr( "\nAIC file read error.\n" );
		return;
		}
	FarlSetPETextureReg(bank);
	for ( i = 0; i < ( num / 2 ); i++ )
		{
		FarlWriteFifoH( buf[i] );
		}
	pio_putstr( "done.\n" );
	return;
	}

/*
 * パターン情報セット
 */
void
SrcSet(unsigned short bank, int xsize, int ysize, int xnum, int ynum)
	{
	int	i,j,n;

	for ( i = 0 ; i < ynum ; i++ )
		{
		for ( j = 0 ; j < xnum ; j++ )
			{
			src[charnumber].bank   = bank;
			src[charnumber].x_pos  = j*xsize;
			src[charnumber].y_pos  = i*ysize;
			src[charnumber].x_size = xsize;
			src[charnumber].y_size = ysize;
			src[charnumber].x_hot  = xsize/2;
			src[charnumber].y_hot  = ysize/2;
			charnumber++;
			}
		}
	}
